<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>员工管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../../../component/elementUI/index.css">
    <link rel="stylesheet" href="../../../style/index.css">
    <link rel="stylesheet" href="./css/base2.css">
</head>
<style>
    ::-webkit-scrollbar {
        width: 8px;
        transform: translateX(8px);
        position: absolute;
        right: 0;
    }

    ::-webkit-scrollbar-thumb {
        background-color: rgb(235,238, 245);
    }
</style>

<body>
    <div id="app" class="minWidth">
        <el-form :inline="true" :form="IO_form">
            <el-form-item>
                <el-button @click="Addemployee" type="primary">添加</el-button>
            </el-form-item>
        </el-form>
        <div style="display: flex;position: relative;">
            <div style="flex: 1;border: 1px solid rgb(235,238, 245);">
                <div style="font-size: 14px; height: 46px;display: flex;align-items: center;font-weight: bold;justify-content: center;color: rgb(144,147,153);border-bottom: 1px solid rgb(235,238, 245);">
                    树状列表
                </div>
                <el-tree :data="Employees" ref="tree" node-key="value" :props="treeProps" @node-click="handleCheckChange" style="height: 500px;overflow-y: auto;">
                    <template v-slot="{data}">
                        <span >{{data.label}}</span>
                    </template>
                </el-tree>
            </div>
            <div style="width: 80%;margin-left: 20px;height: 100%;">
                <el-table :data="selectedData" stripe border height="calc(100vh - 140px)" style="width: 100%">
                    <el-table-column label="序号" width="50" type="index"></el-table-column>
                    <el-table-column label="手机号">
                        <template v-slot="{row}">
                            {{row.User_Number}}
                        </template>
                    </el-table-column>
                    <el-table-column label="昵称">
                        <template v-slot="{row}">
                            {{row.label}}
                        </template>
                    </el-table-column>
                    <el-table-column width="180" label="操作">
                        <template v-slot="{row}">
                            <el-button type="primary" @click="showRoleConfigDialog(row)">配置角色</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <!-- <table class="tb tb-b c-100 c-t-center">
                    <thead>
                        <tr>
                            <th style="width: 33%;">员工编号</th>
                            <th style="width: 33%;">员工</th>
                            <th style="width: 33%;">配置角色</th>
                        </tr>
                    </thead>
                </table>
                <div style="overflow-y: scroll;height: 500px;">
                    <table id="process-demo-1" class="tb tb-b c-100 c-t-center">
                        <tbody>
                            <tr v-for="(item,i) in selectedData" :key="i">
                                <td style="width: 33%;">{{item.value || value}}</td>
                                <td style="width: 33%;">{{item.label || label}}</td>
                                <td style="width: 33%;">
                                    <el-button type="primary" @click="showRoleConfigDialog(item)">配置角色</el-button>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div> -->
                <!-- <div v-else
                    style="width: 100%;height: 400px;display: flex;justify-content: center;align-items: center;">
                    暂无员工数据
                </div> -->
            </div>
        </div>

        <el-dialog title="配置角色" :visible.sync="dialogVisible" width="30%">
            <div v-if="dialogVisible">
                <div>
                    <p>员工编号：{{ selectedRow.User_Number }}</p>
                    <p>员工：{{ selectedRow.label }}</p>
                </div>
                <el-checkbox-group v-model="selectedRoles">
                    <el-checkbox v-for="(role,index) in roles" :key="role.Role_Id" :label="role"
                        :checked="role.isChecked" :value="role" @change="handleCheckboxChange(index)">{{ role.Role_Name
                        }}</el-checkbox>
                </el-checkbox-group>
                <span slot="footer" class="dialog-footer">
                    <el-button @click="dialogVisible = false">关闭</el-button>
                    <el-button type="primary" @click="saveRoles">保存</el-button>
                </span>
            </div>

        </el-dialog>
        <div style="display: flex;justify-content: flex-end;">
            <el-pagination background v-show="II_total > 0" @size-change="handleSizeChange"
                @current-change="handleCurrentChange" :current-page="IO_form.page" :page-sizes="[10,20,30,50]"
                :page-size="IO_form.limit" layout="total, sizes, prev, pager, next, jumper" :total="II_total">
            </el-pagination>
        </div>
    </div>
    <script type="text/javascript" src="../../../utils/jquery-3.6.0.min.js"></script>
    <script type="text/javascript" src="../../../utils/jquery.cookie.js"></script>
    <script type="text/javascript" src="../../../utils/tablesMergeCell.js"></script>
    <script type="text/javascript" src="../../../utils/vue.min.js"></script>
    <script type="text/javascript" src="../../../component/elementUI/index.js"></script>
    <script type="text/javascript" src="../../../utils/utils.js"></script>
    <script type="text/javascript" src="./js/EmployeeDetails.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#process-demo-1').tablesMergeCell({
                cols: [0, 1, 2]
            });
        });
    </script>
</body>

</html>